<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
	<head>
		<title>slider</title>
        <style type='text/css'>
            body {font-family: verdana}
            .error {border: solid 1px red;}
            .error_text { color: red; font-size: 10px;}
            td {padding: 3px;}
			
			#sliderWrapper {
				border: solid 1px gray;
				width: 300px;
				height: 30px;
			}
			#slider {
				width: 30px;
				height: 30px;
				background-color: green;
			}
        </style>
	</head>
	<body>
	    <div id='sliderWrapper'><div id='slider'></div></div>

		<input type='text' id='value' />

		<textarea id='foo'></textarea>
		
		
		<select id='bar'>
			<option value='1'>1</option>
			<option value='2'>2</option>
			<option value='3'>3</option>
			<option value='4'>4</option>
			<option value='5'>5</option>
			<option value='6'>6</option>
			<option value='7'>7</option>
			<option value='8'>8</option>
			<option value='9'>9</option>
			<option value='10'>10</option>
		</select>
<script type='text/javascript' 
        src='../../steal/steal.js'>   
</script>

<script type='text/javascript'>   
steal('jquery/model','mxui/nav/slider').then(function(){

	$.fn.hookup = function(inst, attr, type){
		
		inst.bind(attr, {jQ : this},function(ev, val){
			if(type){
				ev.data.jQ[type]("val", val)
			}else{
				ev.data.jQ.val(val)
			}
		})
		this.bind("change", function(el, val){
			if(type){
				inst.attr(attr, val)
			}else{
				inst.attr(attr, $(this).val())
			}
		})
		var value = inst.attr(attr);
		if(type){
			this[type]("val",value)
		}else{
			this.val(value)
		}
	};
	
	
	
	
	$.Model("Person",{},{});
	
	var person = new Person({age: 1})
	
	$("#slider").mxui_nav_slider({interval: 1, min: 1, max: 10})
		
		.hookup(person,"age","mxui_nav_slider");
	
	$('#value, #foo, #bar').hookup(person,"age");
	
	
});
</script>
	</body>
</html>